while True:
    try:
        score = int(input("请输入学生的成绩："))
        break
    except ValueError:
        print("输入无效，请输入一个有效数字")

if score >= 90:
    grade = "优"
elif score >= 80:
    grade = "良"
elif score >= 70:
    grade = "中等"
elif score >= 60:
    grade = "及格"
else:
    grade = "不及格"

print("该学生的成绩等级为：",grade)
